package com.javaobj.common.convert;

import org.springframework.beans.BeanUtils;

public class SpringObjectConvert<D, V> implements ObjectConvert<D, V> {


    private final Class<V> clz;

    public SpringObjectConvert(Class<V> clz) {
        this.clz = clz;
    }


    @Override
    public V convert(D dto) {
        V obj = BeanUtils.instantiateClass(clz);
        BeanUtils.copyProperties(dto, obj);
        return obj;
    }
}
